Ext.define('DragonApp.view.monster.filter.LocationGroup', {
    extend: 'Ext.form.RadioGroup',
    xtype: 'monster_location_group',

    fieldLabel: '条件细分',

    defaultType: 'radiofield',

    defaults: {
        width: 130
    },

    items: [
        { boxLabel: '不限', name: 'location', inputValue: '0', checked: true },
        { boxLabel: '肉盾', name: 'location', inputValue: '肉盾' },
        { boxLabel: '输出', name: 'location', inputValue: '输出' },
        { boxLabel: '突袭', name: 'location', inputValue: '突袭' }
    ],
    listeners: {
        change: {
            fn: function() {

                var value = this.getValue();
                var store = Ext.data.StoreManager.lookup('jsonPmonsterStore');

                for (key in value) {
                    //清理条件过滤
                    store.clearFilter();

                    //字段筛选
                    if ('0' != value[key]) {
                        store.filter(key, value[key]);
                    }
                }
            }
        }
    }
});